//
// Created by cheng on 2021/02/02.
//

#include <iostream>

using namespace std;

int BinarySearch(int* A, int N, int key) {
    auto left = 0, right = N;
    while (left < right) {
        auto mid = (left+right)/2;
        if (A[mid] == key) {
            return mid;
        } else if (key<A[mid]) {
            right = mid;
        } else {
            left = mid+1;
        }
    }
    return -1;
}

int main() {

}